<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>医生登陆</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <script src="js/vue.js"></script>
    <script src="js/axios.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<h2>医生登录</h2>
    <div id="app">
        <el-form ref="form" :model="loginForm" label-width="80px">
            <el-form-item label="工号">
                <el-input v-model="loginForm.doctorId"></el-input>
            </el-form-item>
            <el-form-item label="密码">
                <el-input type="password" v-model="loginForm.doctorPassword"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="login">登陆</el-button>
            </el-form-item>
        </el-form>
    </div>
    <script>
        var app=new Vue({
            el:"#app",
            data:{
                loginForm:{
                    doctorId:"",
                    doctorPassword:"",
                },
            },
            methods:{
                login:function () {
                   var formData=new FormData();
                    formData.append("doctorId",this.loginForm.doctorId);
                    formData.append("doctorPassword",this.loginForm.doctorPassword);
                    axios.post("medical/doctor/Login",formData).then(function (resp) {
                        if(resp.data.success){
                            window.location="doctor-main.html";
                        }else{
                            alert(resp.data.message);
                        }
                    })
                }
            }

        });
    </script>


</body>
</html>